//----------------------------------------------------------------------------
//  ,-.
// /_\___ ,   Ninja Framework
// '  ___\    (C) Riccardo Capra - http://riccar.do
//  //   \\
//----------------------------------------------------------------------------
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
//----------------------------------------------------------------------------

#ifndef NJ_DEBUG_SYSTEM_H
#	define NJ_DEBUG_SYSTEM_H

#	include "NjNinjaSyncLib.h"
#	include "NjDebugSystem_config.h"
#	include "NjGenericStaticInterface.h"

	/// \brief Interface to debugging features
	class NjDebugSystem : public NjGenericStaticInterface
	{
	public:
		/// Abstract class reppresenting the NjDebugSystem implementation
		class Implementation : public NjGenericStaticInterface::Implementation
		{
			friend class NjDebugSystem;

		public:
			NJ_TRIVIAL_VIRTUAL_DESTRUCTOR(Implementation);

		protected:
			NJ_TRIVIAL_DEFAULT_CONSTRUCTOR(Implementation);

			/// \brief Triggers an hardware breakpoint
			/// \return NJ_TRUE if the method is implemented
			virtual NjBool TriggerBreakPoint() = 0;

			/// \brief Check if the debugger is attached to the process
			/// \return NJ_TRUE if the method is implemented and the debugger is attached
			virtual NjBool IsDebuggerAttached() = 0;

			/// \brief Writes \em szText on the debugger console
			/// \param szText The text to be written to the debugger console
			/// \return NJ_TRUE if the method is implemented
			virtual NjBool WriteToDebugConsole(NjChar const * szText) = 0;

		private:
			NJ_DISABLE_COPY(Implementation);
		};

		/// \copydoc NjDebugSystem::Implementation::TriggerBreakPoint
		///
		/// If NJ_DEBUG_SYSTEM_ENABLED==0 this method does nothing and always returns NJ_FALSE
		static NjBool TriggerBreakPoint();

		/// \copydoc NjDebugSystem::Implementation::IsDebuggerAttached
		///
		/// If NJ_DEBUG_SYSTEM_ENABLED==0 this method does nothing and always returns NJ_FALSE
		static NjBool IsDebuggerAttached();

		/// \copydoc NjDebugSystem::Implementation::WriteToDebugConsole
		///
		/// If NJ_DEBUG_SYSTEM_ENABLED==0 this method does nothing and always returns NJ_FALSE
		static NjBool WriteToDebugConsole(NjChar const * szText);

		NJ_DECLARE_STATIC_INTERFACE_METHODS();

	private:
		NJ_DISABLE_INSTANCE(NjDebugSystem);
	};

#	include "NjDebugSystem_inline.h"

#endif // NJ_DEBUG_SYSTEM_H
